package com.yiqi.liebang.feature.order.view.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.suozhang.framework.framework.AM;
import com.yiqi.liebang.R;
import com.yiqi.liebang.entity.bo.StepBo;

import java.util.List;

public class StepAdapter extends BaseQuickAdapter<StepBo, BaseViewHolder> {
    public StepAdapter() {
        super(R.layout.item_step);
    }

    @Override
    protected void convert(BaseViewHolder helper, StepBo item) {
        helper.setText(R.id.tv_step_name, item.getName());
        TextView tvStep = helper.getView(R.id.tv_step_name);
        View lineLeft = helper.getView(R.id.line_left);
        View lineRight = helper.getView(R.id.line_right);
        ImageView circle = helper.getView(R.id.iv_step_incard);
        switch (item.getState()) {
            case 1:
                tvStep.setTextColor(AM.res().getColor(R.color.primary_highlight));
                lineLeft.setBackgroundColor(AM.res().getColor(R.color.primary_highlight));
                lineRight.setBackgroundColor(AM.res().getColor(R.color.primary_highlight));
                circle.setImageResource(R.drawable.stepview_complete);
                break;
            case 0:
                tvStep.setTextColor(AM.res().getColor(R.color.primary_highlight));
                lineLeft.setBackgroundColor(AM.res().getColor(R.color.primary_highlight));
                lineRight.setBackgroundColor(AM.res().getColor(R.color.div_primary));
                circle.setImageResource(R.drawable.stepview_complete);
                break;
            case -1:
                tvStep.setTextColor(AM.res().getColor(R.color.div_primary));
                lineLeft.setBackgroundColor(AM.res().getColor(R.color.div_primary));
                lineRight.setBackgroundColor(AM.res().getColor(R.color.div_primary));
                circle.setImageResource(R.drawable.stepview_uncomplete);
                break;


        }
    }
}
